-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for WP Rest API paging #1733
Support for WP Rest API paging #1733
Conversation
Deploy preview ready! Built with commit f10625f |
Deploy preview ready! Built with commit f10625f |
Sweet! Thanks for helping out! To clean up the diff, run "npm run format" from the base of the repo. |
@sebastienfi could you handle reviewing and merging this PR? |
Awesome!
|
Will this work for custom post types as well? |
@cr101 As of yet, @alexbassy 's implementation will give the |
@sebastienfi Sorry, I'm currently unable to take this for a spin as I'm recovering from a nasty head cold |
@sebastienfi thanks for the instructions, I found them very useful. I ran the example
|
👍 One more thing
|
Unecessary per_page mention in readme
@cr101 yes! I just tested it using the "Custom Post Type UI" plugin with these options: and it worked just fine, the query was |
@KyleAMathews that's all good for me. I can't merge myself, would you manage it ? |
@@ -8,6 +8,13 @@ | |||
"lodash": "^4.17.4", | |||
"qs": "^6.4.0" | |||
}, | |||
"devDependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove all the babel stuff here? We maintain a common babel setup at the base of the repo. If it's not adequate then please suggest/make modifications there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, done. How do you run npm run watch
using the config from the base of the repo?
@sebastienfi hmmm lemme look into this. |
@sebastienfi you should have merge privileges now. PLEASE always "Squash and merge". Makes the history much more readable. |
This reverts commit 973d85b.
Thanks @alexbassy! Making a new release now. |
Sweet thanks @KyleAMathews. Is there any list of wanted features for this plugin? I might be working with it a fair bit now, so I'd like to contribute back to the project where I can. One of the things I've done was adding posts to categories as child nodes. |
@sebastienfi has been driving this and I know from private conversations has a TODO list for some sites he's working on. You want to make an issue for that Sébastien? |
Hiya @alexbassy! 👋 This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here. Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! 💪💜 |
Package: gatsby-source-wordpress
Currently you have to increase the default
per_page
value of the REST API in functions.php to get more posts. In this PR, theX-WP-Total
header is used to create multiple async requests* for each WP entity type in order to get all of the entities without having to change anything in WordpressBefore:
Max 10 posts returned without editing Wordpress backend
Now:
All entities retrieved with no Wordpress modification
* Waterfall approach might be better in terms of server load, but can take a lot longer if there are a lot of pages. Perhaps adding
request-rate-limiter
(or equivalent) might help with thisP.S. Sorry about the diff, my editor removes trailing whitespace